acli: fix Windows TUI (run_command, wheel scroll) + bench-driven fixes - #188
Merged
Conversation
added 9 commits
September 1, 2026 16:28
Sync agenticCLI v0.6.3 into dashscope/acli: - stagnation tracker with read-only hard cap for oneshot runs - auto_approve config + ACLI_AUTO_APPROVE env override - oneshot mode flag wired into the CLI runner
- convergence nudge becomes budget-aware for autonomous runs - HardenedProvider: capped exponential backoff (3 retries, 4s base, 16s cap) to survive transient model-API failures in long runs
…t for confirmation - New config option confirm_mode: "dangerous" (default) | "all" - CONFIRM-level tools (run_command, write_file, ...) auto-pass in dangerous mode - Read-only commands (grep/ls/cat/...) already skip prompts via is_safe_readonly - Policy deny rules still take precedence over auto-pass - DANGEROUS tools (delete_file, delete_directory) always prompt
…ring Mirrors upstream 4562c7d and picks up the 0.6.4 version bump (SDK version stays 1.27.4, which is still unreleased on this branch). Coding tasks were ending without a single test run because the prompt asked for it: rule 3 said to edit code "without stating a plan first", the Concise bullet banned "test this / verify" as filler, and another bullet forbade reporting what had just been done. - rule 18: run the tests covering the change, or add a focused test when nothing covers it, and report command + pass/fail - rule 4: multi-step work uses create_plan/complete_step, already registered and echoed as "## Current plan" but never mentioned before Tree verified byte-identical to upstream src/acli after the import rewrite; black passed and every dashscope.acli module imports.
…lient header Mirrors agenticCLI 999db69 and 72ecc69: - `-c` returned from main() before the --protocol/--max-turns overrides were applied, so oneshot always ran with the config default of 50 turns. Every terminal-bench run that asked for 150 was really capped at 50. - TongyiProvider now sends acli/<version>[/<module>] in a single x-dashscope-sdk-client header instead of splitting the version into x-dashscope-sdk-version.
Mirrors bc7caee: qwen3.8-max becomes the factory default in Config, TongyiProvider, run_interactive/embedded.run and the Alibaba/Bailian setup preset. Also re-vendors examples from agenticCLI-examples (67f2249) so basic-chat and dashscope-sdk-expert stop overriding that default with qwen3.7-max / qwen3.7-plus.
sys.stdout.encoding was read while decoding subprocess output, but the TUI replaces sys.stdout with textual's capture object, which has no .encoding, so every command failed with AttributeError. The encoding is now resolved at import. Also passes the command to PowerShell as its own argv element (no cmd.exe re-quoting), prefers pwsh, and adds -NoProfile.
With capture off the terminal never learns the app wants mouse events, so Windows Terminal and conhost translate the wheel into arrow keys or scroll their own buffer: the input box moved through its history, or the whole screen dragged, while the output area never scrolled.
Cover the four core components: - is_readonly_tool_call: 67 cases (known tools, shell commands, pipes, redirects, container subcmds, env prefix, edge cases) - ReflectionTracker: 11 cases (threshold, reset, hints, lessons) - StagnationTracker: 10 cases (streak, hard cap, mixed sequences) - convergence_hint: 12 cases (soft/hard boundaries, custom ratios, remaining calculation, disable conditions)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two user-facing Windows TUI repairs, plus the agent-side changes that came out of running the hard task set of terminal-bench, plus the v0.6.4 sync.
Windows TUI: the shell tool was unusable, and scrolling was broken
run_commandfailed on every single call inside the TUI, withAttributeError: '_PrintCapture' object has no attribute 'encoding'. The decode path readsys.stdout.encoding, but textual replacessys.stdoutwith a capture object that has no.encoding— and the read was guarded by anIS_WINDOWSbranch, so POSIX short-circuited and never hit it. The command actually ran; only the decoding blew up, and the error surfaced as a tool failure, so the model retried the identical call until the turn died. The console encoding is now resolved once at import, before the TUI takes over stdout.powershell -Command "<cmd>"went throughcreate_subprocess_shell, i.e. throughcmd.exefirst, so the command was parsed twice. It is now a single argv element viacreate_subprocess_exec, preferspwsh(PowerShell 7) over the legacypowershell.exe, and adds-NoProfile— profile scripts were costing hundreds of milliseconds on every call.CommandInput's history, so wheeling up walked backwards through previous inputs while the output area never moved, and wheeling down walked back to the draft. Alternatively the console host scrolled its own buffer and dragged the whole screen. Capture is now on everywhere;tui_mouse = falsestays as the escape hatch for terminal-native selection (Alt/Option-drag to copy).From the hard-task bench work
oneshot --max-turns/--protocoloverrides — callers driving acli non-interactively need to set the turn budget per task; the flags were previously ignored.qwen3.8-maxacross config, tongyi provider, SDK, embedded UI, setup preset and both examples.Two generalizable agent defects surfaced while reading the failures, worth noting even though neither is fixed here:
jsonschema.validate, passed its own check, and still got the result wrong — the schema constrained a field to "an object" but said nothing about the key names, which the grader indexes differently. Schema-valid is not spec-correct; literal output-contract details (key names, units) have to be checked against the task text./bin/sh: 1: time: not found, becausetimeis a shell builtin and is unavailable undersh -c.The other observation is that these tasks are limited by per-turn model latency rather than by the turn budget: wall clock is dominated by waiting on the model between tool calls, and raising the turn ceiling changed no outcome. Per-call token usage is not captured yet, so "prompt too large" cannot be distinguished from "model slow" — that instrumentation is the prerequisite for optimizing further.
Also in this sync
confirm_mode = dangerous— only risky operations prompt for confirmation.Test plan
test_executor,test_governance_edge), no new ones.run_commandpath, reproduced on POSIX by forcingIS_WINDOWSand installing textual's real_PrintCapture— including the verbatimAttributeErrorthe field report showed. 3 new tests pin thetui_mousedefault and its config escape hatch.blackand thedashscope.acliimport check run byscripts/sync_acli.sh.python -c "import os; print(os.getcwd())".tui_mouse = falsereverts it.